<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片切换</title>
</head>
<body>
    <div id="app">
        <!-- <button  v-show="index<=0?list.length-1:index" @click="index--">上一张</button>
        <div>
            <img :src="list[index]" width="80px" height="80px">
        </div>
        <button v-show="index>=list.length-1?0:index" @click="index++">下一张</button> -->
        <button  v-show="index>0" @click="index--">上一张</button>
        <div>
            <img :src="list[index]" width="100px" height="100px">
        </div>
        <button v-show="index<list.length-1" @click="index++">下一张</button>

    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
    <script>
        const app=new Vue({
            el:'#app',
            data:{
                index:0,
                list:
                [
                    './1.jpeg',
                    './2.jpeg',
                    './3.jpeg',
                    './4.jpeg',
                    './1.jpg',
                ]
            }
        })
    </script>

</body>
</html>